package org.yelongframework.pdm.xml;

import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;

import org.yelongframework.pdm.PdmResolveException;
import org.yelongframework.pdm.PdmTable;

/**
 * 抽象实现
 * 
 * @since 1.0.0
 */
public abstract class AbstractXmlPdmResolver implements XmlPdmResolver {

	@Override
	public List<PdmTable> resolveTables(InputStream inputStream) throws PdmResolveException, IOException {
		List<CTables> cTablesList = resolveCTables(inputStream);
		List<OTable> otables = new ArrayList<>();
		for (CTables cTables : cTablesList) {
			otables.addAll(cTables.getoTableList());
		}
		return otables.stream().map(DefaultXmlPdmTable::new).collect(Collectors.toList());
	}

}
